package com.example.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.domain.Result;
import com.example.dao.AccountDao;
import com.example.domain.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Service
public class LoginServiceImpl extends ServiceImpl<AccountDao, Account> {
    @Autowired
    AccountDao accountDao;
    public Result check(Account account) {
        String email = account.getEmail();
        String password = account.getPassword();
        Account account1 = accountDao.selectById(email);
        if (account1 == null){
            return new Result(false,"该账号不存在，请先注册！");
        }
        String password1 = account1.getPassword();
        boolean b = password.equals(password1);
        if (b == false){
            return new Result(false,"密码错误！");
        }
        return new Result(true,account1);
    }
}
